package io.noties.markwon.plugin.notification.span

import android.graphics.Canvas
import android.graphics.Paint
import android.text.style.ReplacementSpan
import com.gitee.wsl.common.ui.ext.type.textHeight

class NotificationSpan : ReplacementSpan() {

    override fun getSize(
        paint: Paint,
        text: CharSequence?,
        start: Int,
        end: Int,
        fm: Paint.FontMetricsInt?
    ): Int {
       return paint.textHeight.toInt()
    }

    override fun draw(
        canvas: Canvas,
        text: CharSequence?,
        start: Int,
        end: Int,
        x: Float,
        top: Int,
        y: Int,
        bottom: Int,
        paint: Paint
    ) {
       canvas.drawText(text?:"",start,end,x,y.toFloat(),paint)
    }
}